/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 说明：
 * Entity Name 用户
 * @Author：李智深
 * @Date：2012-03-14
 */
@Entity
@Table(name="ruipeng_tb_TUser")
public class TUser implements Serializable{

	private static final long serialVersionUID = 1L;

	private String UserID	;//用户编号CHAR(15)PK

	private String UserName;//用户名	VARCHAR(15)	NOT NULL

	private String Pwd;//密码
	
	private int Sex;//性别 CHAR 1为男 2为女

	private String Phone;//电话VARCHAR(64)

	private String EMail;//邮件地址	VARCHAR(30)

	private byte Status;//状态 	TINYINT	NOT NULL 1为正常  2为锁定 

	private String RealName;//姓名CHAR(20)	NULL

	private Date CreateTime;//注册时间DATETIME
	
	private int	Point;//积分	INTEGER

	private double Money;//资金余额DECIMAL(20,3)

	private String Province;//所在省CHAR(15)

	private String City;//所在市

	private String	Region;//所在区 	

	private String	Location;// 详细地址	VARCHAR(256)

	private String PostCode;//邮编	VARCHAR(20)

	private String Mobile;//移动电话	VARCHAR(30)

	private String NickName;//网名VARCHAR(20)

	private String	NationalID;//身份证号码	CHAR(32)

	private Date LastLoginTime;//最后登录时间DATETIME
	
	private int LoginTimes;//登录次数INTEGER

	private	String BirthDate;//出生日期CHAR(10)

	private String Pic;//用户图像VARCHAR(256)

	private double BuyerScore;//买家信誉 DECIMAL(20,3)

	private String SelfDes;//个性签名VARCHAR(256)

	private String BPwd;//交易密码VARCHAR(15)

	private byte MobileConfirmed;//手机是否已验证TINYINT

	private byte IDConfirmed;//身份证是否已验证1为已经认证 2为正在认证中

	private String	MailCheckCode;//邮箱验证码CHAR(15)

	private byte MailConfirmed;//邮箱是否已认证TINYINT

	private String 	CompanyID;//现任职公司或者学校VARCHAR(64)
	
	private String 	Tag;//用户标签VARCHAR(256)

	private byte Married;//婚否TINYINT 1为已婚 2为未婚 3为保密

	private String IDPicURL;//身份证图片	VARCHAR(128)

	private byte UserNameUpdated;//用户名是否已经修改过 TINYINT1为已经修改 否则为没有修改

	private double TotalBuyMoney;//累计消费金额DECIMAL(20,3)

	private int BuyCount;//消费次数INTEGER
	
	private Set<TOrder> TOrders=new HashSet<TOrder>(0);//订单
	
	private Set<TScheduled> TScheduleds=new HashSet<TScheduled>(0);//在线预订
	
	private Set<TUserRevisit> TUserRevisits=new HashSet<TUserRevisit>(0);//用户访问记录
	
	private Set<TSendInfo> TSendInfos=new HashSet<TSendInfo>(0);//地址
	
	private Set<TMyCashCard> TMyCashCards=new HashSet<TMyCashCard>(0);//商品库存
	
	private Set<TOrderReturn> TOrderReturns=new HashSet<TOrderReturn>(0);//销售退货
	
	private Set<TSendCardRecord> TSendCardRecords=new HashSet<TSendCardRecord>(0); //发卡记录
	
	private Set<TMyMessage> TMyMessages=new HashSet<TMyMessage>();//我的消息
	
	private Set<TMySiteGift> TMySiteGifts=new HashSet<TMySiteGift>(0);//我的礼物
	
	private Set<TOrderRefund> TOrderRefund=new HashSet<TOrderRefund>(0);//退款
	
	private TShopMemberLevel TShopMemberLevel;//商店会员级别定义表
	
	
	private String CardNum;//卡号CHAR(15)
	
	private Date SendCardTime;//发卡时间
	
	private Date EndTime;//用于查询，不进入数据库
	
	public TUser(){}
	
	public TUser(String userID, String realName) {
		super();
		UserID = userID;
		RealName = realName;
	}

	public TUser(String UserID){
		this.UserID=UserID;
	}
	
	@Id
	@Column(name = "UserID", length=15)
	public String getUserID() {
		return UserID;
	}

	public void setUserID(String userID) {
		UserID = userID;
	}

	@Column(name = "UserName", length=15)
	public String getUserName() {
		return UserName;
	}

	public void setUserName(String userName) {
		UserName = userName;
	}

	@Column(name = "Pwd", length=15)
	public String getPwd() {
		return Pwd;
	}

	public void setPwd(String pwd) {
		Pwd = pwd;
	}

	@Column(name = "Sex")
	public int getSex() {
		return Sex;
	}

	public void setSex(int sex) {
		Sex = sex;
	}

	@Column(name = "Phone", length=64)
	public String getPhone() {
		return Phone;
	}

	public void setPhone(String phone) {
		Phone = phone;
	}

	@Column(name = "EMail", length=30)
	public String getEMail() {
		return EMail;
	}

	public void setEMail(String eMail) {
		EMail = eMail;
	}

	@Column(name = "Status")
	public byte getStatus() {
		return Status;
	}

	public void setStatus(byte status) {
		Status = status;
	}

	@Column(name = "RealName", length=20)
	public String getRealName() {
		return RealName;
	}

	public void setRealName(String realName) {
		RealName = realName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CreateTime", nullable = false, length = 19)
	public Date getCreateTime() {
		return CreateTime;
	}

	public void setCreateTime(Date createTime) {
		CreateTime = createTime;
	}

	@Column(name = "Point")
	public int getPoint() {
		return Point;
	}

	public void setPoint(int point) {
		Point = point;
	}

	@Column(name = "Money", precision = 20, scale = 3)
	public double getMoney() {
		return Money;
	}

	public void setMoney(double money) {
		Money = money;
	}

	@Column(name = "Province", length=15)
	public String getProvince() {
		return Province;
	}

	public void setProvince(String province) {
		Province = province;
	}

	@Column(name = "City", length=15)
	public String getCity() {
		return City;
	}

	public void setCity(String city) {
		City = city;
	}

	@Column(name = "Region", length=15)
	public String getRegion() {
		return Region;
	}

	public void setRegion(String region) {
		Region = region;
	}

	@Column(name = "Location", length=256)
	public String getLocation() {
		return Location;
	}

	public void setLocation(String location) {
		Location = location;
	}

	@Column(name = "PostCode", length=20)
	public String getPostCode() {
		return PostCode;
	}

	public void setPostCode(String postCode) {
		PostCode = postCode;
	}

	@Column(name = "Mobile", length=30)
	public String getMobile() {
		return Mobile;
	}

	public void setMobile(String mobile) {
		Mobile = mobile;
	}

	@Column(name = "NickName", length=20)
	public String getNickName() {
		return NickName;
	}

	public void setNickName(String nickName) {
		NickName = nickName;
	}

	@Column(name = "NationalID", length=32)
	public String getNationalID() {
		return NationalID;
	}

	public void setNationalID(String nationalID) {
		NationalID = nationalID;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "LastLoginTime", nullable = false, length = 19)
	public Date getLastLoginTime() {
		return LastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		LastLoginTime = lastLoginTime;
	}

	@Column(name = "LoginTimes")
	public int getLoginTimes() {
		return LoginTimes;
	}

	public void setLoginTimes(int loginTimes) {
		LoginTimes = loginTimes;
	}

	@Column(name = "BirthDate", length=10)
	public String getBirthDate() {
		return BirthDate;
	}

	public void setBirthDate(String birthDate) {
		BirthDate = birthDate;
	}

	@Column(name = "Pic", length=256)
	public String getPic() {
		return Pic;
	}

	public void setPic(String pic) {
		Pic = pic;
	}

	@Column(name = "BuyerScore", precision = 20, scale = 3)
	public double getBuyerScore() {
		return BuyerScore;
	}

	public void setBuyerScore(double buyerScore) {
		BuyerScore = buyerScore;
	}

	@Column(name = "SelfDes", length=256)
	public String getSelfDes() {
		return SelfDes;
	}

	public void setSelfDes(String selfDes) {
		SelfDes = selfDes;
	}

	@Column(name = "BPwd", length=15)
	public String getBPwd() {
		return BPwd;
	}

	public void setBPwd(String bPwd) {
		BPwd = bPwd;
	}

	@Column(name = "MobileConfirmed")
	public byte getMobileConfirmed() {
		return MobileConfirmed;
	}

	public void setMobileConfirmed(byte mobileConfirmed) {
		MobileConfirmed = mobileConfirmed;
	}

	@Column(name = "IDConfirmed")
	public byte getIDConfirmed() {
		return IDConfirmed;
	}

	public void setIDConfirmed(byte iDConfirmed) {
		IDConfirmed = iDConfirmed;
	}

	@Column(name = "MailCheckCode", length=15)
	public String getMailCheckCode() {
		return MailCheckCode;
	}

	public void setMailCheckCode(String mailCheckCode) {
		MailCheckCode = mailCheckCode;
	}

	@Column(name = "MailConfirmed")
	public byte getMailConfirmed() {
		return MailConfirmed;
	}

	public void setMailConfirmed(byte mailConfirmed) {
		MailConfirmed = mailConfirmed;
	}

	@Column(name = "CompanyID", length=64)
	public String getCompanyID() {
		return CompanyID;
	}

	public void setCompanyID(String companyID) {
		CompanyID = companyID;
	}

	@Column(name = "Tag", length=256)
	public String getTag() {
		return Tag;
	}

	public void setTag(String tag) {
		Tag = tag;
	}

	@Column(name = "Married")
	public byte getMarried() {
		return Married;
	}

	public void setMarried(byte married) {
		Married = married;
	}

	@Column(name = "IDPicURL", length=128)
	public String getIDPicURL() {
		return IDPicURL;
	}

	public void setIDPicURL(String iDPicURL) {
		IDPicURL = iDPicURL;
	}

	@Column(name = "UserNameUpdated")
	public byte getUserNameUpdated() {
		return UserNameUpdated;
	}

	public void setUserNameUpdated(byte userNameUpdated) {
		UserNameUpdated = userNameUpdated;
	}


	@Column(name = "TotalBuyMoney", precision = 20, scale = 3)
	public double getTotalBuyMoney() {
		return TotalBuyMoney;
	}

	public void setTotalBuyMoney(double totalBuyMoney) {
		TotalBuyMoney = totalBuyMoney;
	}

	@Column(name = "BuyCount")
	public int getBuyCount() {
		return BuyCount;
	}

	public void setBuyCount(int buyCount) {
		BuyCount = buyCount;
	}

	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TOrder> getTOrders() {
		return TOrders;
	}

	public void setTOrders(Set<TOrder> tOrders) {
		TOrders = tOrders;
	}
	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TScheduled> getTScheduleds() {
		return TScheduleds;
	}

	public void setTScheduleds(Set<TScheduled> tScheduleds) {
		TScheduleds = tScheduleds;
	}

	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TUserRevisit> getTUserRevisits() {
		return TUserRevisits;
	}

	public void setTUserRevisits(Set<TUserRevisit> tUserRevisits) {
		TUserRevisits = tUserRevisits;
	}

	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TSendInfo> getTSendInfos() {
		return TSendInfos;
	}

	public void setTSendInfos(Set<TSendInfo> tSendInfos) {
		TSendInfos = tSendInfos;
	}

	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TMyCashCard> getTMyCashCards() {
		return TMyCashCards;
	}

	public void setTMyCashCards(Set<TMyCashCard> tMyCashCards) {
		TMyCashCards = tMyCashCards;
	}

	@ManyToOne
//	@OneToMany(mappedBy="TShopMemberLevel",fetch=FetchType.EAGER)
	@JoinColumn(name="LevelID")
	public TShopMemberLevel getTShopMemberLevel() {
		return TShopMemberLevel;
	}

	public void setTShopMemberLevel(TShopMemberLevel tShopMemberLevel) {
		TShopMemberLevel = tShopMemberLevel;
	}

	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TOrderReturn> getTOrderReturns() {
		return TOrderReturns;
	}

	public void setTOrderReturns(Set<TOrderReturn> tOrderReturns) {
		TOrderReturns = tOrderReturns;
	}
	@OneToMany(mappedBy="TUser",fetch=FetchType.EAGER)
	@JoinColumn(name="UserID")
	public Set<TSendCardRecord> getTSendCardRecords() {
		return TSendCardRecords;
	}

	public void setTSendCardRecords(Set<TSendCardRecord> tSendCardRecords) {
		TSendCardRecords = tSendCardRecords;
	}
	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TMyMessage> getTMyMessages() {
		return TMyMessages;
	}

	public void setTMyMessages(Set<TMyMessage> tMyMessages) {
		TMyMessages = tMyMessages;
	}
	
	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TMySiteGift> getTMySiteGifts() {
		return TMySiteGifts;
	}
	public void setTMySiteGifts(Set<TMySiteGift> tMySiteGifts) {
		TMySiteGifts = tMySiteGifts;
	}
	@Column(name = "CardNum",length=15)
	public String getCardNum() {
		return CardNum;
	}

	public void setCardNum(String cardNum) {
		CardNum = cardNum;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "SendCardTime", nullable = false, length = 19)
	public Date getSendCardTime() {
		return SendCardTime;
	}

	public void setSendCardTime(Date sendCardTime) {
		SendCardTime = sendCardTime;
	}

	public Date getEndTime() {
		return EndTime;
	}

	public void setEndTime(Date endTime) {
		EndTime = endTime;
	}

	@OneToMany(mappedBy="TUser")
	@JoinColumn(name="UserID")
	public Set<TOrderRefund> getTOrderRefund() {
		return TOrderRefund;
	}

	public void setTOrderRefund(Set<TOrderRefund> tOrderRefund) {
		TOrderRefund = tOrderRefund;
	}
	
}
